var a = getApp();

Page({
    data: {
        active: 0,
        page: 1
    },
    onLoad: function(a) {
        a.id && this.setData({
            active: a.id
        }), this.getSearch();
    },
    goxiangq: function(a) {
        console.log(a.currentTarget.dataset.goodid.goods_id), wx.navigateTo({
            url: "/packageD/auction/auction/auction_good/auction_good?id=" + a.currentTarget.dataset.goodid.goods_id
        });
    },
    toBuy: function(a) {
        var t = a.currentTarget.dataset.item;
        console.log(t, "ddddddd"), wx.navigateTo({
            url: "/packageD/buy/myOrder_v2/myOrder_v2?goodsId=" + t.goods_id + "&tag=auction&total=1&fixed_price=0&auction_sn=" + t.auction_sn
        });
    },
    itemClick: function(a) {
        this.setData({
            active: a.detail.index
        }), this.getSearch();
    },
    getSearch: function() {
        this.setData({
            page: 1
        });
        var t = this, e = "";
        0 == t.data.active ? e = a.getNetAddresss("plugin.auction.api.bid-order.prepayment") : 1 == t.data.active ? e = a.getNetAddresss("plugin.auction.api.bid-order.biding") : 2 == t.data.active ? e = a.getNetAddresss("plugin.auction.api.bid-order.bide") : 3 == t.data.active ? e = a.getNetAddresss("plugin.auction.api.bid-order.finish") : 4 == t.data.active && wx.navigateTo({
            url: "/packageA/member/myOrder_v2/myOrder_v2?status=0&orderType=auction",
            success: function() {
                wx.showLoading({
                    title: "加载中",
                    icon: "none",
                    duration: 1e3
                });
            }
        }), a._postNetWork({
            url: e,
            success: function(a) {
                var e = a.data;
                1 == e.result ? (console.log(e), t.setData({
                    datas: e.data.data,
                    current_page: e.data.current_page,
                    last_page: e.data.last_page
                })) : wx.showToast({
                    title: e.msg,
                    icon: "none",
                    duration: 1e3
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if (this.data.current_page >= this.data.last_page) wx.showToast({
            title: "暂无更多",
            icon: "none",
            duration: 1e3
        }); else {
            var a = this.data.page + 1;
            this.setData({
                page: a
            }), this.getNext();
        }
    },
    onShareAppMessage: function() {},
    getNext: function() {
        var t = this, e = "";
        0 == t.data.active ? e = a.getNetAddresss("plugin.auction.api.bid-order.prepayment") : 1 == t.data.active ? e = a.getNetAddresss("plugin.auction.api.bid-order.biding") : 2 == t.data.active ? e = a.getNetAddresss("plugin.auction.api.bid-order.bide") : 3 == t.data.active ? e = a.getNetAddresss("plugin.auction.api.bid-order.finish") : 4 == t.data.active && wx.navigateTo({
            url: "/packageA/member/myOrder_v2/myOrder_v2?status=0"
        }), a._postNetWork({
            url: e,
            data: {
                page: t.data.page
            },
            success: function(a) {
                var e = a.data;
                1 == e.result ? (console.log(e), t.setData({
                    datas: t.data.datas.concat(e.data.data),
                    current_page: e.data.current_page,
                    last_page: e.data.last_page
                })) : wx.showToast({
                    title: e.msg,
                    icon: "none",
                    duration: 1e3
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    }
});